package com.cloud.serviceverificationcode.controller;

import com.cloud.serviceverificationcode.service.VerifyService;
import com.cloud.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/verify-conde")
public class VerifyController {

    @Autowired
    VerifyService verifyService;

    @GetMapping("/generate/{identity}/{phoneNumber}")
    public ResponseResult<?> generate(@PathVariable("identity") Integer identity,
                                      @PathVariable("phoneNumber")String phoneNumber){
        return verifyService.generate(identity,phoneNumber);
    }


    @GetMapping("/verify/{phoneNumber}/{code}")
    public ResponseResult<?> verify(@PathVariable("phoneNumber")String phoneNumber,
                                    @PathVariable("code")String code){
        return verifyService.verify(phoneNumber,code);
    }

}
